﻿using System;
using System.Collections.Generic;
using System.Text;
using NExt;

namespace NExt.Core
{
    public class AnonymousFunction: IScript
    {
        private const string FUNCTION_TEXT_FORMAT = "function({0}){{{1}}}";
        private const string FUNCTION_PARAMETER_STRING = "";

        public AnonymousFunction(string body)
            : this(FUNCTION_PARAMETER_STRING, body)
        {
        }

        public AnonymousFunction(string parameterString, string body)
        {
            this.body = body;
            this.parameterString = parameterString;
        }

        public string body { get; set; }
        public string parameterString { get; set; }

        public string text
        {
            get { return string.Format(FUNCTION_TEXT_FORMAT, parameterString, body); }
        }
    }
}
